import { useEffect, useRef, Component } from "react";

function Son() {
  return <h2>Son</h2>
}

class Son2 extends Component {
  render() {
    return <h2>Son2</h2>
  }
}

function App() {
  const h1Ref = useRef(null)
  const sonRef = useRef(null)
  const son2Ref = useRef(null)


  useEffect(() => {
    console.log(son2Ref.current);
  }, [])

  return (
    <div>
      <h1 ref={h1Ref}>hello world</h1>
      <Son ref={sonRef}></Son>
      <Son2 ref={son2Ref}></Son2>
    </div>
  )
}

export default App;